#include<iostream>
using namespace std;
void carry(int data[],int position)
{
	if(data[position]==10)
	{
		data[position]=0;
		data[++position]++;
		carry(data,position);
	} 
	else return;
}
int main()
{
    int data[10]={0};
	int n,sum=0,arrive=1,position=0;
	cin>>n;
	while(arrive<=n)
	{
		data[position]++;
		arrive++;
		carry(data,position);
		for(int i=0;i<10;i++)
			sum+=data[i];
	}
	cout<<sum<<endl;
	return 0;
} 
